﻿@{
    ViewBag.Title = "setReportFile";
}

@section scripts
{  
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>
}
        <div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;"> 
            <table style="width:100%;">
                <tr>
                    <td style="width:100%;">
                        <a class="mini-button" id="new" name="new" iconCls="icon-new" onclick="save" plain="true">保存</a>
                        <!--<a class="mini-button" id="new" name="new" iconCls="icon-new" onclick="Design" plain="true">设置报表</a>
                        <a class="mini-button" id="print" name="new" iconCls="icon-new" onclick="print" plain="true">打印</a>-->
                        <span class="separator"></span>
                        <a class="mini-button" id="close" name="close" iconCls="icon-close" onclick="CloseWindow" plain="true">关闭</a>
                    </td>
                </tr>
            </table>       
        </div>     
        <div class="mini-fit">
            <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" 
                    borderStyle="border:1;" url="GetReportData"
                    allowCellSelect="true" allowCellEdit="true" showColumnsMenu="true" fitColumns="false"  
                    onrowdblclick="modify"  sortMode="client">
                <div property="columns">
                    <div type="checkcolumn" >选行</div>
                    <div type="indexcolumn" width="40" headerAlign="center" >序号</div>
                    <div field="FReportName" name="FReportName" width="160" headeralign="center" allowsort="true">报表名称</div>
                    <div field="FReportFile" name="FReportFile" width="500" headeralign="center" allowsort="true">文件名</div>
                    <div field="FUsedFlag0" type="checkboxcolumn" name="FUsedFlag" trueValue="1" 
                        falseValue="0" width="110" headeralign="center" allowsort="true" >开启自定义报表
                    </div>
                </div>
            </div>
        </div>
        <!--<table width = "500px" style="margin-left:20px;">
            <tr>
                <td width="300px" align="right" valign="top">
                    <font color="#FF0000" size ="2" >提示：自定义打印必须安装打印插件，而且只支持IE或360浏览器。</font>
                </td>
                <td width="300px" align="right" valign="top"> 
                    <a href="http://39.108.106.221:3001/Download/grinstall.rar">
                        <i></i><span>下载打印插件</span>
                    </a>
                </td>
            </tr>
        </table>-->   
<script>
    mini.parse();
    function FormShown() {
        LoadListData();
    }
    function setkeyPress() {
        LoadListData();
    }
    //加载资料列表
    function LoadListData() {
        var sSystemAppID = parent.window.getSystemAppID();
        var grid = mini.get("datagrid1");
        grid.load({ mSystemAppID: sSystemAppID });
    }

    function save() {
        var rows = mini.get("datagrid1").getData();
        var json = JSON.stringify(rows);
        debugger;
        $.post("ReportSave", { json: json, mSystemAppID: parent.window.getSystemAppID() }, function (data) {
            var ret = mini.decode(data);
            if (ret.status == 1) {
                mini.showTips({ content: ret.msg, state: "success", x: "center", y: "top", timeout: 3000 });
            }
            else {
                mini.alert("异常:" + ret.error);
            }
        });
    }

    function Design() {
        var row = mini.get("datagrid1").getSelected();
        if (row) {
            if (row.FReportFile == '') return;
            //进入设计页面
            window.location.href = "../Common/DesignReport.aspx?Report=" + row.FReportFile + "&Data=ReportDataService.aspx?SQL=" + ""
        }
    }
</script>